package com.nlscan.ncomgateway.core.newland.common

import com.newland.nlscan.hub.setting.NhubSettings
import com.nlscan.android.scan.ScanSettings

/**
 * todo ScanSettings 改为 NhubSettings 的key
 */
object NlsConst {

    //----------------------- NTS相关 BEGIN ---------------------------//

    /*
        Profile 和 NHubService 定义的字段
        -- com\newland\nlscan\hub\setting\NhubSettings
        -- 返回字段会转为 HashMap<String,String> map

    updateSettings profile: default, settingsMap is null? false
   NhubSettings key: dont_stop_scan_and_delay, value: 0
NhubSettings key: launcher_started, value: 0
NhubSettings key: sendEditorAction, value: false
NhubSettings key: scan_time_out, value: 3000
NhubSettings key: ascii_32_126_as_keyEvent, value: false
NhubSettings key: scan_prompt_vibrator, value: 1
NhubSettings key: prefix, value: null
NhubSettings key: ascii_key_send_interval, value: 100
NhubSettings key: auto_new_line, value: 0
NhubSettings key: scan_result_replace_content, value: null
NhubSettings key: barcodeBroadcastResult2ParamName, value: null
NhubSettings key: scan_mode, value: 2
NhubSettings key: externalScannerBroadcastAction, value: com.nlscan.action.SCANNER_RESULT
NhubSettings key: output_editor_action, value: 6
NhubSettings key: emulate_output_interval_time, value: 2
NhubSettings key: emulateOutputIntervalTime, value: 0
NhubSettings key: suffix_enable, value: 1
NhubSettings key: broadcast_output_extra_key_barcode_type_name, value: SCAN_BARCODE_TYPE_NAME
NhubSettings key: barcodeBroadcastResult1ParamName, value: null
NhubSettings key: suffixEnable, value: false
NhubSettings key: ocrBroadcastResultParamName, value: content
NhubSettings key: scan_interval_time, value: 500
NhubSettings key: scan_prompt_sound, value: 1
NhubSettings key: ascii_1_31_as_keyEvent, value: false
NhubSettings key: broadcast_output_action, value: nlscan.action.SCANNER_RESULT
NhubSettings key: ascii_32_126_as_key_event, value: 0
NhubSettings key: enable_send_custom_suffix_emulate_key, value: 0
NhubSettings key: sendBroadcastOnDirect, value: false
NhubSettings key: outputMode, value: 0
NhubSettings key: httpMethod, value: GET
NhubSettings key: ocrBroadcastAction, value: nlscan.action.OCR_RESULT
NhubSettings key: externalScannerBroadcastExtraMap, value: {}
NhubSettings key: send_scan_failed, value: 1
NhubSettings key: scan_enable, value: 1
NhubSettings key: keyboard_scan_key_main, value: scan
NhubSettings key: scan_repeat_timeout, value: 0
NhubSettings key: udpIp, value: null
NhubSettings key: scan_timeout_sound, value: 0
NhubSettings key: output_broadcast_addition, value: 0
NhubSettings key: enabledChannel, value: 7
NhubSettings key: prefix_enable, value: 1
NhubSettings key: js_code_enable, value: 0
NhubSettings key: outputEditorAction, value: 0
NhubSettings key: scan_trigger_settings_shown, value: 1,2
NhubSettings key: enterKeyUpEnable, value: false
NhubSettings key: scan_interval_min_time, value: 0
NhubSettings key: scan_cache_ena, value: 0
NhubSettings key: trigger_mode_right, value: 1
NhubSettings key: vibrationDuration, value: 80
NhubSettings key: httpParamResultName, value: result
NhubSettings key: trigger_mode_black, value: 1
NhubSettings key: tcpIp, value: null
NhubSettings key: keyboard_scan_key_back, value: scan
NhubSettings key: scan_prompt_vibrator_time, value: 80
NhubSettings key: keyboard_scan_key_left, value: scan
NhubSettings key: jsCode, value: null
NhubSettings key: sendFailBrEnable, value: false
NhubSettings key: trigger_mode_main, value: 1
NhubSettings key: scan_showsendcmdname, value: null
NhubSettings key: ocr_scan_mode, value: 17
NhubSettings key: scan_cache_val, value: 3
NhubSettings key: suffix, value: null
NhubSettings key: ocr_scan_time_out, value: 9000
NhubSettings key: emulate_enter_key_up_enbale, value: 1
NhubSettings key: externalScannerBroadcastResultParamName, value: SCAN_BARCODE1
NhubSettings key: tcpPort, value: 0
NhubSettings key: scan_prompt_led, value: 0
NhubSettings key: outputRecoverable, value: false
NhubSettings key: vibrateEnable, value: true
NhubSettings key: auto_enter_interval, value: 30
NhubSettings key: play_scan_failed_sound_enable, value: 0
NhubSettings key: scan_trim_limits, value: 1
NhubSettings key: autoNewLineEnable, value: false
NhubSettings key: out_put_recoverable, value: 0
NhubSettings key: keyboard_scan_key_right, value: scan
NhubSettings key: barcodeBroadcastStrTypeParamName, value: null
NhubSettings key: barcodeBroadcastTypeParamName, value: null
NhubSettings key: broadcast_output_extra_key_result_2, value: SCAN_BARCODE2
NhubSettings key: prefixEnable, value: false
NhubSettings key: broadcast_output_extra_key_result_1, value: SCAN_BARCODE1
NhubSettings key: scan_encode, value: 4
NhubSettings key: barcodeBroadcastAction, value: null
NhubSettings key: scan_can_disable, value: 1
NhubSettings key: data_format_mode, value: 0
NhubSettings key: data_format_list, value: [{"name":"Data Format 0","command":""},{"name":"Data Format 1","command":""},{"name":"Data Format 2","command":""},{"name":"Data Format 3","command":""}]
NhubSettings key: udpPort, value: 0
NhubSettings key: output_editor_action_enable, value: 0
NhubSettings key: launch_app_by_matched_result_enable, value: 0
NhubSettings key: data_format_select, value: Data Format 0
NhubSettings key: trigger_mode_left, value: 1
NhubSettings key: httpUrl, value: null
NhubSettings key: js_code, value: null
NhubSettings key: launch_app_by_matched_result_delay_time, value: 1000
NhubSettings key: custom_suffix_emulate_key, value:
NhubSettings key: broadcast_output_extra_key_barcode_type, value: SCAN_BARCODE_TYPE
NhubSettings key: ledEnable, value: true
NhubSettings key: ocrBroadcastExtraMap, value: {}
NhubSettings key: soundEnable, value: true
NhubSettings key: output_mode, value: 1
NhubSettings key: ascii_1_31_as_key_event, value: 0

     */


    const val NLS_DATA_HUB_SERVICE = "nlsdatahubservice"


    const val EXTRA_PROFILE_NAME = "profile"

    const val DEFAULT_PROFILE_NAME = "default"


    /*
        todo 待确认
        1、 NhubSettings.GlobalKey.OUTPUT_MODE 定义的值 跟 实际的 key 不一致
        1、public static final String OUTPUT_MODE = "outputMode";
        2、NhubSettings key: output_mode, value: 2
        当前获取到，会返回0

        ScanSettings.Global 保持一致？
        这里取值 要跟         public static final String OUT_PUT_MODE = getStringFieldValue("OUT_PUT_MODE", "output_mode");
     */

    //[bugFix]修复获取输出模式为未设置问题(0)
//    const val NTS_OUTPUT_MODE = NhubSettings.GlobalKey.OUTPUT_MODE
    var NTS_OUTPUT_MODE: String = ScanSettings.Global.OUT_PUT_MODE

    /**
     * key: broadcast_output_action, value: nlscan.action.SCANNER_RESULT
     */
    var NTS_BROADCAST_OUTPUT_ACTION = ScanSettings.Global.BROADCAST_OUTPUT_ACTION
    var NTS_BROADCAST_OUTPUT_EXTRA_KEY_RESULT_1 =
        ScanSettings.Global.BROADCAST_OUTPUT_EXTRA_KEY_RESULT_1
    var NTS_BROADCAST_OUTPUT_EXTRA_KEY_RESULT_2 =
        ScanSettings.Global.BROADCAST_OUTPUT_EXTRA_KEY_RESULT_2
    var NTS_BROADCAST_OUTPUT_EXTRA__KEY_BARCODE_TYPE =
        ScanSettings.Global.BROADCAST_OUTPUT_EXTRA__KEY_BARCODE_TYPE
    var NTS_BROADCAST_OUTPUT_EXTRA__KEY_BARCODE_TYPE_NAME =
        ScanSettings.Global.BROADCAST_OUTPUT_EXTRA__KEY_BARCODE_TYPE_NAME

    // TODO: 待确认 2024-07-07 barcodeBroadcastResult1ParamName 是否有用


    /*
    @see com.newland.nlscan.hub.setting.NhubSettings
    //OCR广播 action
    public String ocrBroadcastAction;
    //OCR广播扫码结果参数
    public String ocrBroadcastResultParamName = "result";
    //读码广播 action
    public String barcodeBroadcastAction;
    //读码广播结果1参数名称
    public String barcodeBroadcastResult1ParamName;
    //读码广播结果2参数名称
    public String barcodeBroadcastResult2ParamName;
    //读码广播码制类型参数名称
    public String barcodeBroadcastTypeParamName;
    //读码广播码制类型(String)参数名称
    public String barcodeBroadcastStrTypeParamName;
     */

    /**
     * key: ocrBroadcastAction, value: null
     * {
     * "note": "广播action",
     * "key": "nlsOcrSendResultAction",
     * "view_type": "edittext",
     * "default": "nlscan.action.OCR_RESULT"
     * },
     */
    var NTS_OCR_BROADCAST_ACTION = NhubSettings.GlobalKey.OCR_BROADCAST_ACTION

    /**
     * key: ocrBroadcastResultParamName, value: result
     */
    var NTS_OCR_BROADCAST_RESULT_PARAM_NAME = NhubSettings.GlobalKey.OCR_BROADCAST_RESULT_PARAM_NAME

    /**
     * key: ocrBroadcastExtraMap, value: {}
     * -- [Protocol] 默认传回空，则使用 OCR 默认值
     */
    var NTS_OCR_BROADCAST_EXTRA_MAP = NhubSettings.GlobalKey.OCR_BROADCAST_EXTRA_MAP


    /**
     * -- 将 OCR 默认值作为key, 这部分参数 NhubService 不维护
     */
    val NTS_OCR_BROADCAST_EXTRA_CONFIDENCE = NlsConfig.DEFAULT_OCR_SEND_RESULT_EXTRA_CONFIDENCE
    val NTS_OCR_BROADCAST_EXTRA_ALL_CONFIDENCE =
        NlsConfig.DEFAULT_OCR_SEND_RESULT_EXTRA_ALL_CONFIDENCE
    val NTS_OCR_BROADCAST_EXTRA_COORDINATE = NlsConfig.DEFAULT_OCR_SEND_RESULT_EXTRA_COORDINATE
    val NTS_OCR_BROADCAST_EXTRA_ORIGINAL_DATA =
        NlsConfig.DEFAULT_OCR_SEND_RESULT_EXTRA_ORIGINAL_DATA
    val NTS_OCR_BROADCAST_EXTRA_IMAGE = NlsConfig.DEFAULT_OCR_SEND_RESULT_EXTRA_IMAGE


    /**
     * 解码提示-声音使能
     * key: soundEnable, value: true
     * @see NhubManager#setIndicateSoundEnableOfProfile
     * 替代 BCR(BarCodeReader) 定义 scan_prompt_sound (ScanSettings.Global.SCAN_PROMPT_SOUND)
     */
    const val NTS_SOUND_ENABLE = NhubSettings.GlobalKey.SOUND_ENABLE

    /**
     * 解码提示-震动使能
     * key: vibrateEnable, value: true
     * @see NhubManager#setIndicateVibrateEnableOfProfile
     * 替代 BCR(BarCodeReader) 定义 scan_prompt_vibrator (ScanSettings.Global.)
     */
    const val NTS_VIBRATE_ENABLE = NhubSettings.GlobalKey.VIBRATE_ENABLE

    /**
     * 解码提示-LED使能
     * key: ledEnable, value: true
     * @see NhubManager#setIndicateLedEnableOfProfile
     * 替代 BCR(BarCodeReader) 定义 scan_prompt_led (ScanSettings.Global.VALUE_SCAN_PROMPT_LED_ON)
     */
    const val NTS_LED_ENABLE = NhubSettings.GlobalKey.LED_ENABLE

    /**
     * key: prefix, value: null
     */
    const val NTS_PREFIX = NhubSettings.GlobalKey.PREFIX

    /**
     * key: prefixEnable, value: false
     * 这个是之前ScanSettings 定义的字段 key: prefix_enable, value: 1
     *
     */
    const val NTS_PREFIX_ENABLE = NhubSettings.GlobalKey.PREFIX_ENABLE

    /**
     * key: suffix, value: null
     */
    const val NTS_SUFFIX = NhubSettings.GlobalKey.SUFFIX

    /**
     * key: suffixEnable, value: false
     * 这个是之前ScanSettings 定义的字段 key: suffix_enable, value: 1
     *
     */
    const val NTS_SUFFIX_ENABLE = NhubSettings.GlobalKey.SUFFIX_ENABLE


    //----------------------- NTS相关 END ---------------------------//


}